//
//  YDNewFeatureController.m
//  biyingqiquan
//
//  Created by LK-IOS on 2018/4/18.
//  Copyright © 2018年 LK-BYQQIOS. All rights reserved.
//

#import "YDNewFeatureController.h"
#import "YDNewFeatureCell.h"
#import "YDBaseTabBarController.h"

#define FeatureCellCount 3


@interface YDNewFeatureController ()<NewFeatureCelllDelegate>

//上一次scrollView的位置
@property (nonatomic , assign) CGFloat preoffsetX;


@end

@implementation YDNewFeatureController

static NSString * const reuseIdentifier = @"YDNewFeatureCell";

-(instancetype)init
{
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
    layout.itemSize = CGSizeMake([UIScreen mainScreen].bounds.size.width   , [UIScreen mainScreen].bounds.size.height);
    layout.minimumLineSpacing = 0;
    layout.minimumInteritemSpacing = 0;
    layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    return [super initWithCollectionViewLayout:layout];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.collectionView registerClass:[YDNewFeatureCell class] forCellWithReuseIdentifier:reuseIdentifier];
    self.collectionView.bounces = NO;
    self.collectionView.pagingEnabled = YES;
    self.collectionView.showsHorizontalScrollIndicator = NO;
    self.collectionView.showsVerticalScrollIndicator = NO;
    
    [[SYVersionManger sharedInstance] loadAppVersionInformation];
    
    
}
#pragma mark <UICollectionViewDataSource>
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return FeatureCellCount;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    YDNewFeatureCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];
    cell.delegate = self;
    cell.imageString = [NSString stringWithFormat:@"newGuideImage0%zd" , indexPath.item + 1];
    [cell btnHiddenWithItem:indexPath.item count:FeatureCellCount];
    return cell;
}

-(void)newFeatureCellEnterButtonClick
{
    YDBaseTabBarController *tabbar = [[YDBaseTabBarController alloc] init];
    [UIApplication sharedApplication].keyWindow.rootViewController = tabbar;
}



@end
